Why is my recursive function returning a None value

welcome to shbcf.ru